#!/usr/bin/env bash
git pull
ids[0]="clound-eureka-server"
ids[1]="app-consumer"
ids[2]="app-provider"
ids[3]="clound-eureka-zipkin"
for var in ${ids[@]};
do
	PROCESS=`ps -ef|grep $var|grep -v grep|grep -v PPID|awk '{ print $2}'`
	for i in $PROCESS
	do
	  echo "Kill the  $var process [ $i ]"
	  kill -9 $i
	done
done

cd ./app/app-consumer/
mvn clean
mvn  -DskipTests=true  package
nohup  java -jar  /home/toread/IdeaProjects/springclound/app/app-consumer/target/app-consumer-0.0.1-SNAPSHOT.jar  start > app-consumer.log &
echo 'app-consumer 启动成功'
cd /home/toread/IdeaProjects/springclound/app/app-provider
mvn clean
mvn  -DskipTests=true  package
nohup  java -jar  /home/toread/IdeaProjects/springclound/app/app-provider/target/app-provider-0.0.1-SNAPSHOT.jar  start > app-provider.log &
echo 'app-provider 启动成功'
cd /home/toread/IdeaProjects/springclound/clound-eureka-server
mvn clean
mvn  -DskipTests=true  package
nohup  java -jar  /home/toread/IdeaProjects/springclound/clound-eureka-server/target/clound-eureka-server-0.0.1-SNAPSHOT.jar start > clound-eureka-server.log &
echo 'clound-eureka-server 启动成功'

cd /home/toread/IdeaProjects/springclound/clound-eureka-zipkin
mvn clean
mvn  -DskipTests=true  package
nohup  java -jar  /home/toread/IdeaProjects/springclound/clound-eureka-zipkin/target/clound-eureka-zipkin-0.0.1-SNAPSHOT.jar start > clound-eureka-zipkin.log &
echo 'clound-eureka-zipkin 启动成功'